<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jspf"%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>

		<!--Import materialize.css-->
		<link type="text/css" rel="stylesheet" href="${ctx}/static/css/materialize.min.css" media="screen,projection" />
		<!-- 导入补充样式 -->
		<link type="text/css" rel="stylesheet" href="${ctx}/static/css/supplement.css" />
		<!-- Material Design图标 -->
		<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

		<!--Let browser know website is optimized for mobile-->
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	</head>

	<body>
		<header>
			<nav>
				<div class="nav-wrapper">
					<div class="col s12" style="padding: 0 0.75em;">
						<a href="#" class="breadcrumb">员工管理</a>
						<a href="#" class="breadcrumb">员工维护</a>
					</div>
				</div>
			</nav>

			<div class="container"></div>
			<%@ include file="/jsp/nav.jsp" %>
		</header>

		<main>
			<div class="row">
				<div class="col s12 m8 110">
					<div class="row"></div>
					<div class="row">
						<div class="col s12">
							<!-- Dropdown Trigger -->
							<a class='dropdown-button btn' href='#' data-activates='dropdown'>选择部门</a>

							<!-- Dropdown Structure -->
							<ul id='dropdown' class='dropdown-content'>
								<c:forEach items="${departments}" var="d" varStatus="status">
                                    <li>
                                        <a href="findEmployeesByDepartmentId.action?departmentId=${d.id }">${d.name}</a>
                                    </li>
                                </c:forEach>
							</ul>
							
							<a class="waves-effect waves-light btn right" href="toSaveEmployee.action">新增员工</a>
						</div>
					</div>

					<div class="row">
						<div class="col s12">
							<div class="card">
								<table class="highlight centered">
									<thead>
										<tr>
											<th data-field="realName">姓名</th>
											<th data-field="username">登录名</th>
											<th data-field="departmentName">所属部门</th>
											<th data-field="sex">性别</th>
											<th data-field="operate">操作</th>
										</tr>
									</thead>

									<tbody>
										<c:forEach items="${employees}" var="e" varStatus="status">
                                            <tr>
                                                <td>${e.realName}</td>
                                                <td>${e.username}</td>
                                                <td>${e.department.name}</td>
                                                <td>${e.sex}</td>
                                                <td>
                                                    <a class="waves-effect waves-light btn" href="toEditEmployee.action?id=${e.id }">修改</a>
                                                    <a class="waves-effect waves-light btn" href="deleteEmployee.action?id=${e.id }">删除</a>
                                                </td>
                                            </tr>
                                        </c:forEach>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</main>

		<script src="${ctx}/static/js/jquery-3.1.0.min.js"></script>
		<script src="${ctx}/static/js/materialize.min.js"></script>
	</body>

</html>